<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Parse Invocations</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Parse Invocations' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">values</a></li><li><a href="index.html#4">Chapter 4: The S-Parser</a></li><li><b>Parse Invocations</b></li></ul></div>
<p class="purpose">To register phrases with the excerpt parser, and to provide the excerpt parser with help in putting invocations together.</p>

<ul class="toc"><li><a href="4-pi.html#SP1">&#167;1. Introduction</a></li><li><a href="4-pi.html#SP2">&#167;2. Registering phrase prototypes with the excerpt parser</a></li><li><a href="4-pi.html#SP4">&#167;4. Converting excerpt parser results to invocation lists</a></li><li><a href="4-pi.html#SP5">&#167;5. A more detailed view later on</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Introduction.</b>"To..." phrases are defined with prototypes: for example, in
</p>

<blockquote>
    <p>To add (new entry - K) to (L - list of values of kind K), if absent: ...</p>
</blockquote>

<p class="commentary">the prototype is <span class="extract"><span class="extract-syntax">add (new entry - K) to (L - list of values of kind K)</span></span>. In
this section we define three related functions: one to register the prototype
with the excerpt parser, one to convert any textual match against that to an
invocation subtree, and one to perform more detailed parsing on such a subtree
later on.
</p>

<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Registering phrase prototypes with the excerpt parser.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParseInvocations::register_excerpt</span><span class="plain-syntax">(</span><span class="identifier-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">type_data</span><span class="plain-syntax"> = &amp;(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">type_data</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">registration_text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">PHRASE_REGISTRATION</span><span class="plain-syntax">, </span><span class="string-syntax">"Register phrase &lt;%W&gt; with type:\n$h"</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">type_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">IDTypeData::is_a_say_phrase</span><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Register a say</span><span class="named-paragraph-number">2.1</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP2_2" class="named-paragraph-link"><span class="named-paragraph">Register anything else</span><span class="named-paragraph-number">2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b>Here the prototype is <span class="extract"><span class="extract-syntax">say ...</span></span>, but we trim off the word "say", since it is
not needed when the phrase is invoked in (for example) a text substitution.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Register a say</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="4-pi.html#SP3" class="function-link"><span class="function-syntax">ParseInvocations::register_phrasal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">SAY_PHRASE_MC</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Wordings::trim_first_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2" class="paragraph-anchor"></a><b>&#167;2.2. </b>Note that control structures have prototypes such as <span class="extract"><span class="extract-syntax">if (V - value) is begin</span></span>,
in which the keyword "begin" at the end is similarly not registered, since it
is now no longer a compulsory part of the syntax.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Register anything else</span><span class="named-paragraph-number">2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">IDTypeData::get_mor</span><span class="plain-syntax">(</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_NOTHING_MOR:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">as_inline</span><span class="plain-syntax">.</span><span class="identifier-syntax">block_follows</span><span class="plain-syntax"> != </span><span class="identifier-syntax">NO_BLOCK_FOLLOWS</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::trim_last_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="4-pi.html#SP3" class="function-link"><span class="function-syntax">ParseInvocations::register_phrasal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VOID_PHRASE_MC</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_CONDITION_MOR:</span>
<span class="plain-syntax">            </span><a href="4-pi.html#SP3" class="function-link"><span class="function-syntax">ParseInvocations::register_phrasal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">COND_PHRASE_MC</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DECIDES_VALUE_MOR:</span>
<span class="plain-syntax">            </span><a href="4-pi.html#SP3" class="function-link"><span class="function-syntax">ParseInvocations::register_phrasal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VALUE_PHRASE_MC</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>All those possibilities result in a call to the following function, with <span class="extract"><span class="extract-syntax">mc</span></span>
set to the appropriate meaning code and <span class="extract"><span class="extract-syntax">W</span></span> the registration text, perhaps
trimmed a little. Surprisingly, though, this begins a recursion, since the function
calls itself in order to provide for alternate wordings in prototypes:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParseInvocations::register_phrasal</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">ParseInvocations::register_phrasal</span></span>:<br/><a href="4-pi.html#SP2_1">&#167;2.1</a>, <a href="4-pi.html#SP2_2">&#167;2.2</a>, <a href="4-pi.html#SP3_2_1">&#167;3.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">unsigned</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax">, </span><span class="identifier-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Vet phrase text for suitability</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Look for slash-divided alternative phrasings and recurse to register all variations</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">With slashes out of the picture, register what we have</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b>Some sanity checks first:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Vet phrase text for suitability</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bl</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">fixed_words</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax"> == </span><span class="identifier-syntax">SAY_PHRASE_MC</span><span class="plain-syntax">) </span><span class="identifier-syntax">fixed_words</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_WORDING</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">OPENBRACKET_V</span><span class="plain-syntax">) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACKET_V</span><span class="plain-syntax">) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bl</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">fixed_words</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Vocabulary::test_flags</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">TEXT_MC</span><span class="plain-syntax">+</span><span class="identifier-syntax">TEXTWITHSUBS_MC</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_1_1" class="named-paragraph-link"><span class="named-paragraph">Issue problem for quoted text in phrase wording</span><span class="named-paragraph-number">3.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACKET_V</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1) == </span><span class="identifier-syntax">OPENBRACKET_V</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_1_2" class="named-paragraph-link"><span class="named-paragraph">Issue problem for brackets jammed up against each other</span><span class="named-paragraph-number">3.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fixed_words</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_1_3" class="named-paragraph-link"><span class="named-paragraph">Issue problem for phrase consisting only of tokens</span><span class="named-paragraph-number">3.1.3</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_1" class="paragraph-anchor"></a><b>&#167;3.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue problem for quoted text in phrase wording</span><span class="named-paragraph-number">3.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> != </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_QuotedInPhrase</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"phrases can't be defined with quoted text as part of the fixed wording"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"so something like 'To go \"voluntarily\" to jail: ...' is not allowed."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_1">&#167;3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_2" class="paragraph-anchor"></a><b>&#167;3.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue problem for brackets jammed up against each other</span><span class="named-paragraph-number">3.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> != </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_AdjacentTokens</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"phrases can't be defined so that they have two bracketed varying elements "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"immediately next to each other"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"but instead need at least one fixed word in between. Thus 'To combine "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"(X - a number) (Y - a number)' is not allowed, but 'To combine (X - a "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"number) with (Y - a number)' works because of the 'with' dividing the "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"bracketed terms X and Y."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_1">&#167;3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1_3" class="paragraph-anchor"></a><b>&#167;3.1.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue problem for phrase consisting only of tokens</span><span class="named-paragraph-number">3.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> != </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_MustBeOneWord</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"a 'To...' phrase must contain at least one fixed word"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"that is, one word other than the bracketed variables. So a declaration "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"like 'To (N - number): ...' is not allowed."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_1">&#167;3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b>The remaining work is to look out for this sort of thing:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">To</span><span class="plain-syntax"> </span><span class="identifier-syntax">rearrange</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">deckchairs</span><span class="plain-syntax">/</span><span class="identifier-syntax">loungers</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ship</span><span class="plain-syntax">): ...</span>
</pre>
<p class="commentary">where the slash indicates an alternative wording:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Look for slash-divided alternative phrasings and recurse to register all variations</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bl</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_WORDING</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">OPENBRACKET_V</span><span class="plain-syntax">) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACKET_V</span><span class="plain-syntax">) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bl</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax"> == </span><span class="identifier-syntax">SAY_PHRASE_MC</span><span class="plain-syntax">) </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Lexer::word_raw_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Lexer::word_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">]; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">j</span><span class="plain-syntax">&gt;0) &amp;&amp; (</span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">-1] != </span><span class="character-syntax">'/'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] == </span><span class="character-syntax">'/'</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1]) &amp;&amp; (</span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1] != </span><span class="character-syntax">'/'</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_2_1" class="named-paragraph-link"><span class="named-paragraph">This word is divided by a forward slash at the j-position in word i</span><span class="named-paragraph-number">3.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_1" class="paragraph-anchor"></a><b>&#167;3.2.1. </b>What we do is to reconstruct this as two different registrations:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">To</span><span class="plain-syntax"> </span><span class="identifier-syntax">rearrange</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">deckchairs</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ship</span><span class="plain-syntax">): ...</span>
<span class="identifier-syntax">To</span><span class="plain-syntax"> </span><span class="identifier-syntax">rearrange</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">loungers</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ship</span><span class="plain-syntax">): ...</span>
</pre>
<p class="commentary">and then recursively call ourselves to handle each individual one. We'll call
the left and right hand sides of "deckchairs/loungers" the A and B forms.
</p>

<p class="commentary">Note than a phrase with many slashed words will register a frightening number of
possibilities &mdash; for example,
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">&gt;&gt; </span><span class="identifier-syntax">To</span><span class="plain-syntax"> </span><span class="identifier-syntax">meld</span><span class="plain-syntax">/</span><span class="identifier-syntax">blend</span><span class="plain-syntax">/</span><span class="identifier-syntax">merge</span><span class="plain-syntax"> (</span><span class="identifier-syntax">O</span><span class="plain-syntax"> - </span><span class="identifier-syntax">object</span><span class="plain-syntax">) </span><span class="identifier-syntax">onto</span><span class="plain-syntax">/</span><span class="identifier-syntax">into</span><span class="plain-syntax">/</span><span class="identifier-syntax">amongst</span><span class="plain-syntax">/</span><span class="identifier-syntax">with</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> - </span><span class="identifier-syntax">object</span><span class="plain-syntax">) </span><span class="identifier-syntax">quickly</span><span class="plain-syntax">/</span><span class="identifier-syntax">rapidly</span><span class="plain-syntax">/</span><span class="identifier-syntax">pronto</span><span class="plain-syntax">: ...</span>
</pre>
<p class="commentary">will register 36 excerpts. But the hashing in the excerpts parser shouldn't
make the result too slow, and in any case authors do not often do this.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">This word is divided by a forward slash at the j-position in word i</span><span class="named-paragraph-number">3.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_2_1_1" class="named-paragraph-link"><span class="named-paragraph">Splice up the A and B forms of the slashed word</span><span class="named-paragraph-number">3.2.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_2_1_2" class="named-paragraph-link"><span class="named-paragraph">Make sure the A form isn't the S-word</span><span class="named-paragraph-number">3.2.1.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">AW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">, </span><span class="identifier-syntax">BW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP3_2_1_3" class="named-paragraph-link"><span class="named-paragraph">Splice up the A and B forms of the whole phrase wording</span><span class="named-paragraph-number">3.2.1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">AW</span><span class="plain-syntax">)) </span><a href="4-pi.html#SP3" class="function-link"><span class="function-syntax">ParseInvocations::register_phrasal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">AW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">BW</span><span class="plain-syntax">)) </span><a href="4-pi.html#SP3" class="function-link"><span class="function-syntax">ParseInvocations::register_phrasal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">BW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_2">&#167;3.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_1_1" class="paragraph-anchor"></a><b>&#167;3.2.1.1. </b>The double-dash means "omit this word altogether".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Splice up the A and B forms of the slashed word</span><span class="named-paragraph-number">3.2.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">k</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">j</span><span class="plain-syntax">; </span><span class="identifier-syntax">k</span><span class="plain-syntax">++) </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">k</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax">=</span><span class="identifier-syntax">j</span><span class="plain-syntax">+1; </span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">k</span><span class="plain-syntax">]; </span><span class="identifier-syntax">k</span><span class="plain-syntax">++) </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">[</span><span class="identifier-syntax">k</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"--"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">Str::clear</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"--"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">Str::clear</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_2_1">&#167;3.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_1_2" class="paragraph-anchor"></a><b>&#167;3.2.1.2. </b>If we don't check this then hybrids like <span class="extract"><span class="extract-syntax">To say/adjust (X - an object)</span></span> will
confuse two fundamentally different sorts of phrase. ("Say" is allowed after the
first word, though.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make sure the A form isn't the S-word</span><span class="named-paragraph-number">3.2.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::eq_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"say"</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax"> != </span><span class="identifier-syntax">SAY_PHRASE_MC</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> != </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_SaySlashed</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"'say' is not allowed as the first word of a phrase"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"even when presented as one of a number of slashed alternatives. "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"(This is because 'say' is reserved for creating text substitutions.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">last_phrase_with_problem_on_prototype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_2_1">&#167;3.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2_1_3" class="paragraph-anchor"></a><b>&#167;3.2.1.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Splice up the A and B forms of the whole phrase wording</span><span class="named-paragraph-number">3.2.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">feed_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Feeds::begin</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="identifier-syntax">Feeds::feed_wording</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">Feeds::feed_text_expanding_strings</span><span class="plain-syntax">(</span><span class="identifier-syntax">a_form</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="identifier-syntax">Feeds::feed_wording</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">AW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Feeds::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">id</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">id</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Feeds::begin</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="identifier-syntax">Feeds::feed_wording</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">Feeds::feed_text_expanding_strings</span><span class="plain-syntax">(</span><span class="identifier-syntax">b_form</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="identifier-syntax">Feeds::feed_wording</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">BW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Feeds::end</span><span class="plain-syntax">(</span><span class="identifier-syntax">id</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3_2_1">&#167;3.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">With slashes out of the picture, register what we have</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">PHRASE_REGISTRATION</span><span class="plain-syntax">, </span><span class="string-syntax">"Register phrasal on &lt;%W&gt; with mc %08x\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Lexicon::register</span><span class="plain-syntax">(</span><span class="identifier-syntax">phrase_mc</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">STORE_POINTER_id_body</span><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Converting excerpt parser results to invocation lists.</b>Suppose, then, that the excerpt parser has identified a phrase which it
thinks may be being invoked in some text. It will have given us this subtree
as its preliminary findings <span class="extract"><span class="extract-syntax">p</span></span>:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">VOID_PHRASE_MC</span><span class="plain-syntax"> </span><span class="string-syntax">"add 17 to the list of small primes, if absent"</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax"> </span><span class="string-syntax">"if absent"</span><span class="plain-syntax"> {</span><span class="identifier-syntax">is</span><span class="plain-syntax">-</span><span class="identifier-syntax">phrase</span><span class="plain-syntax">-</span><span class="identifier-syntax">option</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax"> </span><span class="string-syntax">"17"</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax"> </span><span class="string-syntax">"the list of small primes"</span>
</pre>
<p class="commentary">and we need to return a two-token invocation subtree &mdash; see <a href="4-inv.html" class="internal">Invocations</a> for
what these look like.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">ParseInvocations::results_as_invocation</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">ParseInvocations::results_as_invocation</span></span>:<br/>Conditions and Phrases - <a href="4-cap.html#SP12_1">&#167;12.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"parse against null subtree"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">WW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_text</span><span class="plain-syntax">[</span><span class="identifier-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">]; </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_tokens</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP4_1" class="named-paragraph-link"><span class="named-paragraph">Extract all this text from the results subtree</span><span class="named-paragraph-number">4.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inv</span><span class="plain-syntax"> = </span><a href="4-inv.html#SP1" class="function-link"><span class="function-syntax">Invocations::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-inv.html#SP2" class="function-link"><span class="function-syntax">Invocations::invoke_To_phrase</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">idb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP4_2" class="named-paragraph-link"><span class="named-paragraph">Create the ith token</span><span class="named-paragraph-number">4.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">)) </span><a href="4-inv.html#SP15" class="function-link"><span class="function-syntax">Invocations::set_phrase_options</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">MATCHING</span><span class="plain-syntax">, </span><span class="string-syntax">"Results as invocation: $e\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">inv</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">inv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4_1" class="paragraph-anchor"></a><b>&#167;4.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Extract all this text from the results subtree</span><span class="named-paragraph-number">4.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">p</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">Annotations::read_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="identifier-syntax">is_phrase_option_ANNOT</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (; ((</span><span class="identifier-syntax">p</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">no_tokens</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">)); </span><span class="identifier-syntax">p</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">) == </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">token_text</span><span class="plain-syntax">[</span><span class="identifier-syntax">no_tokens</span><span class="plain-syntax">++] = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"Unexpected production in phrase args"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">no_tokens</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::fatal</span><span class="plain-syntax">(</span><span class="string-syntax">"MAX_TOKENS_PER_PHRASE exceeded"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_2" class="paragraph-anchor"></a><b>&#167;4.2. </b>As can be seen, the way we parse the token text depends on the context,
that is, depends on what we're expecting to find. (This is why the excerpt
parser needs our help in the first place.) See <a href="../assertions-module/5-ptd.html" class="internal">Phrase Type Data (in assertions)</a>
for what these contextual codes mean.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Create the ith token</span><span class="named-paragraph-number">4.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">type_data</span><span class="plain-syntax"> = &amp;(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to_match</span><span class="plain-syntax"> = </span><span class="identifier-syntax">type_data</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">X</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Articles::remove_the</span><span class="plain-syntax">(</span><span class="identifier-syntax">token_text</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="identifier-syntax">construct</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NEW_LOCAL_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">to_match</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP1" class="function-link"><span class="function-syntax">Specifications::from_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">NEW_LOCAL_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IDTypeData::token_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">OLD_LOCAL_IDTC:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">to_match</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP1" class="function-link"><span class="function-syntax">Specifications::from_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">LVALUE_LOCAL_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IDTypeData::token_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">STORAGE_IDTC:</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">LVALUE_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_kind_of_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TABLE_REF_IDTC:</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">LVALUE_TR_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_kind_of_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONDITION_IDTC:</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">CONDITION_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">VOID_IDTC:</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">VOID_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-spc.html#SP2" class="function-link"><span class="function-syntax">Specifications::is_kind_like</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">RVALUE_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP1" class="function-link"><span class="function-syntax">Specifications::to_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-spc.html#SP3" class="function-link"><span class="function-syntax">Specifications::is_description</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">MATCHING_RVALUE_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP1" class="function-link"><span class="function-syntax">Specifications::to_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::is</span><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">, </span><span class="identifier-syntax">CONSTANT_NT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">SPECIFIC_RVALUE_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP1" class="function-link"><span class="function-syntax">Specifications::to_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><a href="4-inv.html#SP9" class="function-link"><span class="function-syntax">Invocations::attach_token</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">RVALUE_CONTEXT_NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">); </span><span class="comment-syntax"> doesn't actually happen</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><a href="4-inv.html#SP12" class="function-link"><span class="function-syntax">Invocations::set_token_to_be_parsed_against</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">K</span><span class="plain-syntax">) </span><a href="4-inv.html#SP11" class="function-link"><span class="function-syntax">Invocations::set_kind_required_by_context</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP11" class="function-link"><span class="function-syntax">Specifications::new_UNKNOWN</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-inv.html#SP10" class="function-link"><span class="function-syntax">Invocations::set_token_as_parsed</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. A more detailed view later on.</b>In the invocation subtrees constructed above, the wording in the tokens has
not even been looked at: we now have something like this &mdash;
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">INVOCATION_NT</span><span class="plain-syntax"> </span><span class="string-syntax">"add 17 to the list of small primes, if absent"</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RVALUE_CONTEXT_NT</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax"> </span><span class="string-syntax">"17"</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RVALUE_CONTEXT_NT</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">UNKNOWN_NT</span><span class="plain-syntax"> </span><span class="string-syntax">"the list of small primes"</span>
</pre>
<p class="commentary">It is now time to look inside those <span class="extract"><span class="extract-syntax">UNKNOWN_NT</span></span> nodes.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParseInvocations::parse_within_inv</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">ParseInvocations::parse_within_inv</span></span>:<br/>Dash - <a href="5-dsh.html#SP10_9_1_1">&#167;10.9.1.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">PreformCache::warn_of_changes</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><a href="4-inv.html#SP6" class="function-link"><span class="function-syntax">Invocations::get_no_tokens</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">N</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to_match</span><span class="plain-syntax"> = </span><a href="4-inv.html#SP12" class="function-link"><span class="function-syntax">Invocations::get_token_to_be_parsed_against</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cons</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">id_body</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idb</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_phrase_invoked</span><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idb</span><span class="plain-syntax">) </span><span class="identifier-syntax">cons</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idb</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">type_data</span><span class="plain-syntax">.</span><span class="identifier-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">].</span><span class="identifier-syntax">construct</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">cons</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CONDITION_IDTC</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">cons</span><span class="plain-syntax"> == </span><span class="identifier-syntax">VOID_IDTC</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax"> = </span><a href="4-inv.html#SP10" class="function-link"><span class="function-syntax">Invocations::get_token_as_parsed</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Parse this token</span><span class="named-paragraph-number">5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Node::set_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="4-inv.html#SP10" class="function-link"><span class="function-syntax">Invocations::set_token_as_parsed</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inv</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b>For the probable NP context and the let equation context, see
<a href="4-teav.html" class="internal">Type Expressions and Values</a>. They just mean "what kind of value might
we expect here?" and "is this an equation?" respectively.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse this token</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">save_probable_noun_phrase_context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">probable_noun_phrase_context</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">probable_noun_phrase_context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-spc.html#SP2" class="function-link"><span class="function-syntax">Specifications::is_kind_like</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">probable_noun_phrase_context</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP1" class="function-link"><span class="function-syntax">Specifications::to_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP5_1_1" class="named-paragraph-link"><span class="named-paragraph">Parse within this probable kind</span><span class="named-paragraph-number">5.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">probable_noun_phrase_context</span><span class="plain-syntax"> = </span><span class="identifier-syntax">save_probable_noun_phrase_context</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_1_1" class="paragraph-anchor"></a><b>&#167;5.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse within this probable kind</span><span class="named-paragraph-number">5.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">save_let_equation_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">let_equation_mode</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">let_equation_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IDTypeData::is_a_let_equation</span><span class="plain-syntax">(</span><span class="identifier-syntax">idb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP5_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Parse within this equation context</span><span class="named-paragraph-number">5.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">let_equation_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">save_let_equation_mode</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP5_1">&#167;5.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_1_1_1" class="paragraph-anchor"></a><b>&#167;5.1.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse within this equation context</span><span class="named-paragraph-number">5.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">K_stored_action</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Kinds::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">probable_noun_phrase_context</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_stored_action</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP5_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Parse a stored action</span><span class="named-paragraph-number">5.1.1.1.1</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP5_1_1_1_2" class="named-paragraph-link"><span class="named-paragraph">Parse any other token</span><span class="named-paragraph-number">5.1.1.1.2</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP5_1_1">&#167;5.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_1_1_1_1" class="paragraph-anchor"></a><b>&#167;5.1.1.1.1. </b>This awkward manoeuvre just means that if the actions feature is active, and
therefore <span class="extract"><span class="extract-syntax">K_stored_action</span></span> exists, and if we need to be parsing something to
match that, then we need to parse action patterns in a different context from
the usual one. (The syntax to describe the action used in "if taking a book"
and "try taking a book" looks the same, but in fact the former allows much
more flexibility than the latter, so the action pattern parser needs to be
told if it is supposed to parse only in the more restricted way.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse a stored action</span><span class="named-paragraph-number">5.1.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">saved</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ParseActionPatterns::enter_mode</span><span class="plain-syntax">(</span><span class="identifier-syntax">PERMIT_TRYING_OMISSION</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;action-pattern&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax"> = </span><span class="identifier-syntax">AConditions::new_action_TEST_VALUE</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ParseActionPatterns::exit_mode</span><span class="plain-syntax">(</span><span class="identifier-syntax">PERMIT_TRYING_OMISSION</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-pi.html#SP5_1_1_1_2" class="named-paragraph-link"><span class="named-paragraph">Parse any other token</span><span class="named-paragraph-number">5.1.1.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ParseActionPatterns::restore_mode</span><span class="plain-syntax">(</span><span class="identifier-syntax">saved</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP5_1_1_1">&#167;5.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_1_1_1_2" class="paragraph-anchor"></a><b>&#167;5.1.1.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse any other token</span><span class="named-paragraph-number">5.1.1.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="comment-syntax"> redundant assignment to keep the compiler happy</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-spc.html#SP3" class="function-link"><span class="function-syntax">Specifications::is_description</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">to_match</span><span class="plain-syntax">)) </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;s-value&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cons</span><span class="plain-syntax"> == </span><span class="identifier-syntax">CONDITION_IDTC</span><span class="plain-syntax">)              </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;s-condition&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cons</span><span class="plain-syntax"> == </span><span class="identifier-syntax">VOID_IDTC</span><span class="plain-syntax">)                   </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;s-command&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax">                                          </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;s-value&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax">) </span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax"> = </span><a href="2-spc.html#SP11" class="function-link"><span class="function-syntax">Specifications::new_UNKNOWN</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">MATCHING</span><span class="plain-syntax">, </span><span class="string-syntax">"(%d/%d) Expected kind %u: parsed token %W (cons %d) to $P\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1, </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">probable_noun_phrase_context</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">, </span><span class="identifier-syntax">cons</span><span class="plain-syntax">, </span><span class="identifier-syntax">as_parsed</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-pi.html#SP5_1_1_1">&#167;5.1.1.1</a> and <a href="4-pi.html#SP5_1_1_1_1">&#167;5.1.1.1.1</a>.</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="4-inv.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-vm.html">1</a></li><li class="progresschapter"><a href="2-spc.html">2</a></li><li class="progresschapter"><a href="3-pl.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-ets.html">ets</a></li><li class="progresssection"><a href="4-cad.html">cad</a></li><li class="progresssection"><a href="4-teav.html">teav</a></li><li class="progresssection"><a href="4-varc.html">varc</a></li><li class="progresssection"><a href="4-cap.html">cap</a></li><li class="progresssection"><a href="4-il.html">il</a></li><li class="progresssection"><a href="4-inv.html">inv</a></li><li class="progresscurrent">pi</li><li class="progresschapter"><a href="5-dsh.html">5</a></li><li class="progressnext"><a href="5-dsh.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

